package library_management.operation.impl;

import library_management.book.Book;
import library_management.book.BookList;
import library_management.operation.IOperation;

public class BorrowedOperation implements IOperation {
    @Override
    public void work(BookList bookList) {
        System.out.println("=====================================");
        System.out.println("您现在正在进行借书操作！");
        System.out.println("请输入您要借阅的图书");
        String borrowBook = scanner.next();
        if(bookList.isContains(borrowBook))
        {
            if(bookList.isBookBorrow(borrowBook))
            {
                System.out.println("这本书已经借出，不能再借！");
            }
            else
            {
                bookList.borrow(borrowBook);
                System.out.println("借书成功！");
            }
        }
        else
        {
            System.out.println("很抱歉，图书馆暂时没有这本书~");
        }
    }
}
